import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CouponInfoVO, CouponInfoForm, CouponInfoQuery } from '@/api/kitchen/coupon/info/types';

/**
 * 查询套餐里的美食信息列表
 * @param query
 * @returns {*}
 */

export const listCouponInfo = (query?: CouponInfoQuery): AxiosPromise<CouponInfoVO[]> => {
  return request({
    url: '/kitchen/couponInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询套餐里的美食信息详细
 * @param id
 */
export const getCouponInfo = (id: string | number): AxiosPromise<CouponInfoVO> => {
  return request({
    url: '/kitchen/couponInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增套餐里的美食信息
 * @param data
 */
export const addCouponInfo = (data: CouponInfoForm) => {
  return request({
    url: '/kitchen/couponInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改套餐里的美食信息
 * @param data
 */
export const updateCouponInfo = (data: CouponInfoForm) => {
  return request({
    url: '/kitchen/couponInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除套餐里的美食信息
 * @param id
 */
export const delCouponInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/kitchen/couponInfo/' + id,
    method: 'delete'
  });
};
